package com.shiminghui.test;

import java.util.Random;

public class YanZhengMa {
    public static void main(String[] args) {


        char[] arr = new char[52];

        for (int i = 0; i < arr.length; i++) {
            if (i<26){
                arr[i]= (char) ('A'+i);
            }else {
                arr[i]=(char) (i-26+'a');
            }

        }

        char[] arr2 = new char[4];

        Random random = new Random();
        for (int i = 0; i < arr2.length; i++) {
            arr2[i]=arr[random.nextInt(arr.length)];
        }

        String s = new String(arr2);

        int sum = random.nextInt(10);
        int index= random.nextInt(5);

        if (index==0){
            s = sum+s;
        }else
        if (index==4){
            s=s+sum;
        }else {
            String befor = s.substring(0,index);
            String end = s.substring(index);
            s=befor+sum+end;
        }


        System.out.println(s);

    }
}
